﻿function openWindow(url, intWidth, intHeight, title) {

    var win = Ext.create('widget.window', {
        title: title,
        closable: true,
        closeAction: 'hide',
        layout: 'fit',
        width: intWidth,
        minWidth: 150,
        height: intHeight,
        layout: {
            type: 'border',
            padding: 5
        },
        items: [{
            region: 'center',
            xtype: 'tabpanel',
            autoLoad: url
        }]
    });
    win.show(this, null);
}

function openObjWindow(object, intWidth, intHeight, title) {

    var win = Ext.create('widget.window', {
        title: title,
        closable: true,
        closeAction: 'hide',
        layout: 'fit',
        width: intWidth,
        minWidth: 150,
        height: intHeight,
        layout: {
            type: 'border',
            padding: 5
        },
        items: [object]
    });

    win.show(this, null);
}



if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function (elt /*, from*/) {
        var len = this.length;

        var from = Number(arguments[1]) || 0;
        from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
        if (from < 0)
            from += len;

        for (; from < len; from++) {
            if (from in this &&
          this[from] === elt)
                return from;
        }
        return -1;
    };
}


if (!Array.prototype.add) {
    Array.prototype.add = function (item) {
        var len = this.length;
        this[len] = item;
    };
}
